#include <bits/stdc++.h>
using namespace std;
int x[200010],y[200010],z[200010];
int f[200010][3];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> x[i] >> y[i] >> z[i];
  for (int i = 1; i <= n; i++) {
    f[i][0] = max(f[i - 1][1]+x[i], f[i - 1][2]+x[i]);
    f[i][1] = max(f[i - 1][0]+y[i], f[i - 1][2]+y[i]);
    f[i][2] = max(f[i - 1][0]+z[i], f[i - 1][1]+z[i]);
  }
  cout << max(f[n][0], max(f[n][1], f[n][2]));
  return 0;
}